package httpClient;

import java.io.FileInputStream;
import java.io.InputStream;

public class TestThreadHttpClient {
	public static void main(String[] args) {
		new Thread(new Runnable() {
			
			public void run() {
				while(true) {
					try {
						long start = System.currentTimeMillis();
						String path = "src/main/resources/file/json.json";
						InputStream is = new FileInputStream(path);
						byte[] bytes = new byte[5000];
						is.read(bytes);
						String msg = new String(bytes);
						System.out.println(msg);
//						System.out.println(new Date());
						is.close();
						String result = HttpClient4.doPostWithJson("http://localhost:18888/wcs/task_i", msg.trim());
						System.out.println(result);
						long end = System.currentTimeMillis();
						System.out.println(end - start);
						Thread.sleep(1000);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		}).start();
	}
}
